import React from 'react';
import './index.css';

import {Redirect, Route, Switch} from 'react-router-dom';
import LeftMenu from '../../components/left_menu';
import TopNavigation from '../../components/top_navigation';
import Home from './home';
import NoPermission from './no_permission';
import {Layout} from 'antd';
import UserList from './user/userList'
import RoleList from './role_power/role/roleList'
import PowerList from './role_power/power/powerList'

const {Content} = Layout;

/**
 * 主页组件，布局组件
 */
function NewsSandBox() {

  return (
    <Layout>
      {/* 侧边栏 */}
      <LeftMenu/>
      <Layout className="site-layout">
        {/* 导航栏 */}
        <TopNavigation/>
        <Content
          className="site-layout-background"
          style={{
            margin: '24px 16px',
            padding: 24,
            minHeight: 280,
          }}
        >
          <Switch>
            <Route path='/home' component={Home}/>
            <Route path='/user/list' component={UserList}/>
            <Route path='/role_power/role/list' component={RoleList}/>
            <Route path='/role_power/power/list' component={PowerList}/>
            {/* 默认 路径/ 跳转到首页 */}
            <Redirect exact from='/' to='/home'/>
            {/* 输入错误路径，则跳转到403页面 */}
            <Route path='*' component={NoPermission}/>
          </Switch>
        </Content>
      </Layout>
    </Layout>
  );
}

export default NewsSandBox;